package com.zkny.zknyerp.controller;

import com.zkny.zknyerp.model.Scenario;
import com.zkny.zknyerp.model.Type;
import com.zkny.zknyerp.service.ScenarioService;
import com.zkny.zknyerp.service.TypeService;
import com.zkny.zknyerp.utils.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;


/**
 * 用户对外接口
 */
@RestController
@RequestMapping("/api/type")
@CrossOrigin
public class TypeController {

    @Autowired
    private TypeService typeService;

    @GetMapping("/addType")
    public Result addType(@RequestParam String tname){
        return typeService.addType(tname);
    }

    @GetMapping("/selectType")
    public Result selectType(Integer page,Integer limit){
        return  typeService.selectType(page,limit);

    }

    @PostMapping("/updateType")
    public Result updateType(@RequestBody Type type){
        return typeService.updateType(type);
    }

    @DeleteMapping("/deleteType")
    public Result deleteType(@RequestBody Type type){
        return typeService.deleteType(type);
    }

    @GetMapping("/getId")
    public Result getId(Integer id){
        return typeService.getId(id);
    }

    @GetMapping("/getType")
    public Result getType(){
        return typeService.getType();
    }
}
